package io.github.codelifeleno.jdbrelease.config;

import java.util.Objects;
import java.util.StringJoiner;

/**
 * 单行结束符的处理的配置
 */
public class StatementSeparators {
    /**
     * 默认的行结束符
     */
    private String simple = ";";
    /**
     * 默认的脚本结束符
     */
    private String eof = "^^^ END OF SCRIPT ^^^";

    @Override
    public String toString() {
        return new StringJoiner(", ", StatementSeparators.class.getSimpleName() + "[", "]")
                .add("simple='" + simple + "'")
                .add("eof='" + eof + "'")
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;

        StatementSeparators that = (StatementSeparators) o;
        return Objects.equals(getSimple(), that.getSimple()) && Objects.equals(getEof(), that.getEof());
    }

    @Override
    public int hashCode() {
        int result = Objects.hashCode(getSimple());
        result = 31 * result + Objects.hashCode(getEof());
        return result;
    }

    public String getSimple() {
        return simple;
    }

    public void setSimple(String simple) {
        this.simple = simple;
    }

    public String getEof() {
        return eof;
    }

    public void setEof(String eof) {
        this.eof = eof;
    }

    public StatementSeparators() {
    }

    public StatementSeparators(String simple, String eof) {
        this.simple = simple;
        this.eof = eof;
    }
}
